package cn.tq.pethome.bean;

import lombok.Getter;
import lombok.ToString;

@ToString
@Getter
public class AjaxResult {
    private Boolean state = true;
    private String message = "操作成功";

    //构造方法私有化
    private AjaxResult() {
    }

    public static AjaxResult myAjax() {
        return new AjaxResult();
    }

    //操作成功返回
    public static AjaxResult success() {
        return myAjax();
    }

    //操作失败时候返回
    public static AjaxResult fail() {
        return myAjax().setMessage("操作失败").setState(false);
    }

    //链式编程
    private AjaxResult setState(Boolean state) {
        this.state = state;
        return this;
    }

    private AjaxResult setMessage(String message) {
        this.message = message;
        return this;
    }

    private void A() {
        System.out.println("这是1.3版本");
    }

    private void B() {
        System.out.println("这是1.4版本的");
    }

    private void c(){
        System.out.println("这次一把梭哈");
    }

    private void d(){
        System.out.println("这次一定可以一把梭");
    }

}